package work.mediway.mdm.core.enums;

import cn.hutool.core.util.StrUtil;
import work.mediway.mdm.core.exception.DataException;

/**
 * @author zhongyj <1126834403@qq.com><br/>
 * @date 2021/9/1
 */
public enum ServiceMessageDataSourceTypeEnum {

    /**
     * SQL
     */
    SQL,

    /**
     * Table
     */
    Table;

    public static ServiceMessageDataSourceTypeEnum getEnum(String type) {
        for (ServiceMessageDataSourceTypeEnum typeEnum : ServiceMessageDataSourceTypeEnum.values()) {
            if (StrUtil.equalsIgnoreCase(typeEnum.name(), type)) {
                return typeEnum;
            }
        }
        throw new DataException(StrUtil.format("[ type = {} ] 不存在", type));
    }
}
